package com.streamkar.entity.request;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.streamkar.entity.base.Request;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName CreateIncentiveRequest
 * @Description
 * @Author tyfrost
 * @Date 2018/12/5 10:57 AM
 * @Version 1.0
 */
public class CreateIncentiveRequest extends Request {
    /**
     * 所属国家
     */
    @NotEmpty
    private JSONArray country;
    /**
     * 开始时间
     */
    @NotBlank
    private String startDate;
    /**
     * 结束时间
     */
    @NotBlank
    private String endDate;
    /**
     * Incentive 描述
     */
    @NotBlank
    private String keyWord;
    /**
     * Incentive 图片
     */
    @NotBlank
    private String coverImg;

    private JSONObject jsonObject = new JSONObject();

    public JSONObject toEvent(Integer userId) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        jsonObject.put("createUserId", userId);
        jsonObject.put("createDate", sdf.format(new Date()));
        jsonObject.put("status", 0);
        return jsonObject;
    }

    public JSONArray getCountry() {
        return country;
    }

    public void setCountry(JSONArray country) {
        this.country = country;
        jsonObject.put("country", country);
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
        jsonObject.put("startDate", startDate);
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
        jsonObject.put("endDate", endDate);
    }

    public String getKeyWord() {
        return keyWord;
    }

    public void setKeyWord(String keyWord) {
        this.keyWord = keyWord;
        jsonObject.put("keyWord", keyWord);
    }

    public String getCoverImg() {
        return coverImg;
    }

    public void setCoverImg(String coverImg) {
        this.coverImg = coverImg;
        jsonObject.put("coverImg", coverImg);
    }
}
